/services/session

  • module
services/session

{function()}

 

GET /services/session

Gets the current session, if any.

GET /services/session

Returns

{JSON}

An object containing the user object with sensitive properties omitted.

{
  user: {
    "id": Int,
    "name": String,      // Optional name
    "email": String,     // User email address
    "isAdmin": Boolean,  // Whether user is an admin
    "verified": Boolean  // Whether user has verified an email address
  }
}

POST /services/session

If a user object is provided with a valid password/email combination, logs in the current user and creates a session.

POST /services/session
  {
    user: {
      {
        "email": "addyfizzle@publicdefenders.org"
        "password": "H3HLJ2HIO4"
      }
    }
  }

Returns

{JSON}

An object containing the logged in user object with sensitive properties omitted.

{
  user: {
    "id": 9,
    "name": "Atticus Finch",
    "email": "addyfizzle@publicdefenders.org",
    "isAdmin": false,
    "verified": true
  }
}

DELETE /services/session

Logs the current user out.

DELETE /services/session

Returns

{JSON}

Returns an empty JSON object.

{}